package ${package}.entity;

import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.neusoft.jn.common.base.BaseModel;
import lombok.Data;
import com.neusoft.jn.sys.common.annotation.Excel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neusoft.jn.sys.common.utils.StringUtils;
import java.io.Serializable;

/**
* @author ${author}
* @since ${date}
* @description：${tableComment!}
*/
@Data
@TableName("${table_name}")
public class ${TableName} implements Serializable {
private static final long serialVersionUID = 1L;
<#list  columns as field>
    <#if field.isPk=="1">
        @TableId(value="${field.COLUMN_NAME!}",type= IdType.ASSIGN_UUID)
    <#else>
        @TableField("${field.COLUMN_NAME!}")
    </#if>
        @Excel(name = "${field.columnComment!}")
        private ${field.javaType} ${field.columnName};
</#list>
        private transient Date beginCreatedTime;
        private transient Date endCreatedTime;
        private transient Date beginUpdatedTime;
        private transient Date endUpdatedTime;
    public QueryWrapper genQryWrapper() {
        QueryWrapper wrapper = new QueryWrapper();
        if (StringUtils.isNotEmpty(createdBy)) {
            wrapper.eq("CREATED_BY",createdBy);
        }
        if (beginCreatedTime!=null && endCreatedTime!=null) {
            wrapper.between("CREATED_TIME",beginCreatedTime,endCreatedTime);
        } else if (beginCreatedTime!=null) {
            wrapper.ge("CREATED_TIME",beginCreatedTime);
        } else if (endCreatedTime!=null) {
            wrapper.le("CREATED_TIME",endCreatedTime);
        }
        if (StringUtils.isNotEmpty(updatedBy)) {
            wrapper.eq("UPDATED_BY",updatedBy);
        }
        if (beginUpdatedTime!=null && endUpdatedTime!=null) {
            wrapper.between("UPDATED_TIME",beginUpdatedTime,endUpdatedTime);
        } else if (beginUpdatedTime!=null) {
            wrapper.ge("UPDATED_TIME",beginUpdatedTime);
        } else if (endUpdatedTime!=null) {
            wrapper.le("UPDATED_TIME",endUpdatedTime);
        }
        return wrapper;
    }
}
